class Compont {
    _data = {
        name: '',
    };
    flag = true;
    constructor() {
        this.data = new Proxy(this._data, {
            set: (target, name, value) => {
                target[name] = value;
                if (this.flag) {
                    this.flag = false;
                    Promise.resolve().then(() => {
                        this.render();
                        this.flag = true;
                    });
                }
                // return value;
            },
        });
        return this;
    }
    render() {
        console.log('render', this.data.name);
    }
}
let Com = new Compont();
console.log(Com, 'Com');
Com.data.name = 'zhangsan';
Com.data.name = 'lisi';
setTimeout(() => {
    Com.data.name = 'wangwu';
}, 0);
setTimeout(() => {
    Com.data.name = 'sssss';
}, 0);
